package patternmining.model.construction.bpsl;

import java.util.logging.Level;
import java.util.logging.Logger;
import org.antlr.runtime.RecognitionException;
import org.antlr.runtime.tree.CommonTree;
import org.antlr.runtime.tree.CommonTreeNodeStream;
import patternmining.model.graph.bpsl.BpslFormula;

public class BpslAst {

    private CommonTree ast;
    private BpslFormula formula;

    public BpslAst(CommonTree ast){
        this.ast = ast;
    }

    public void analizeAst(){
        try {
            CommonTreeNodeStream treeAsNodeStream = new CommonTreeNodeStream(ast);
            BpslSinglePassTreeWalker treewalker = new BpslSinglePassTreeWalker(treeAsNodeStream);
            formula = treewalker.specification();
        } catch (RecognitionException ex) {
        }
    }
    
    public BpslFormula getFormula(){
        return formula;
    }

}
 
